#ifndef POLYNOMIALS
#define POLYNOMIALS

#include <iostream>
#include <vector> 
#include <cmath>

using namespace std;

class Polynomial {
public:
    double left_point;
    double right_point;
    int degree;
    vector<double> coefficients;

public:
    // 在给定点 x 处计算多项式的值
    double value(double x) const {
        double result = 0.0;
        for (int i = 0; i <= degree; i++) {
            result += coefficients[i] * pow(x - left_point, i);
        }
        return result;
    }
};

#endif // POLYNOMIALS